package com.gyf.algorithm.struc.utils;

import com.gyf.algorithm.structure.linerlist.List;

import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;

public class Test1 {
    private String name ="123";
    private List<String> list;
    public static void main(String[] args) {
        Class<Test1> aClass = Test1.class;
        try {
            Field field = aClass.getDeclaredField("name");
            System.out.println(field.getType());
            System.out.println(field.getName());
            System.out.println(field.getType().getName());

            Field list = aClass.getDeclaredField("list");
            System.out.println(list.getGenericType());
            System.out.println(list.getType());
            System.out.println(list.getName());
            System.out.println(((ParameterizedType)list.getGenericType()).getActualTypeArguments()[0].getTypeName());

        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        }


    }
}
